﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BLL;
using BLL.Interfaces;
using DAL.DBInteractions;
using DAL.EntityRepository;
using Microsoft.Practices.ServiceLocation;
using Microsoft.Practices.Unity;

namespace MagazineWebForms.Boostrapper
{
    public class BootStrapper
    {

    
            private static readonly IUnityContainer _container = new UnityContainer();
            public static void Initialize()
            {
                ServiceLocator.SetLocatorProvider(() => new UnityServiceLocator(_container));
                _container
                    .RegisterType<IDBFactory, DBFactory>()
                    .RegisterType<IUnitOfWork, UnitOfWork>()
                   .RegisterType<IAuteurServices, AuteurServices>()
                    .RegisterType<IAuteurRepository, AuteurRepository>()

                      .RegisterType<IArticlesServices, ArticlesServcices>()
                      .RegisterType<IArticleRepository, ArticleRepository>()

                      .RegisterType<IUserProfileServices, UserProfileServices>()
                     .RegisterType<IUserProfileRepository, UserProfileRepository>();

            }

            public static void TearDown()
            {
                _container.Dispose();
            }
        }
    }
